home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / wordpro / we16_95g.zip / WWWEDIT.DL_ < prev    next >
Text File  |  1995-01-30  |  6KB  |  170 lines

  1. ; This is a common WIL script file for the editor.  It is used by both the
  2. ; utility menu in the Professional version and also for some internal
  3. ; editor functions...like looking up keyword help on a mouse click.
  4.  
  5.       CancelCmd="exit"
  6.       W9876A=WinExeName("")
  7.       W9876A=FileRoot(W9876A)
  8.       goto %param1%
  9.  
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11. :BUTTONMACRO
  12. ; we get here via a line like
  13. ; Call("WWWEDIT.DLL", "BUTTONMACRO 1")  Add a goto label to jump to 
  14. ; a specific section
  15. ; e.g.
  16. ;       goto butmac%param2%
  17. ;      :butmac1
  18. ;          code here
  19. ;          return
  20. ;      :butmac2
  21. ;           code here
  22. ;          return
  23.         Message("Sample Macro","You called user macro number %param2%")
  24.         exit
  25.  
  26.  
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28. :KEYWORDHELP
  29.  
  30. ;First do some initialization and grab the word help is desired for.
  31.  
  32.     CancelCmd="goto KWHDONE"      ; Setup cancel processing - clear variables
  33.     HelpWord = wEdGetWord()         ; Get Selected word
  34.     if HelpWord=="" then Message("%W9876A% Help Error","Cursor must be on a word to use this function.")
  35.                     then Goto KWHDONE
  36.  
  37.  
  38.  
  39.  
  40. ; Locate our WEHELP.INI file and determine help file list to process
  41.     WEDir = DirHome()
  42.     inifile = StrCat(WEDir, "HELP\WEHELP.INI")
  43.     if FileExist(inifile)==@FALSE then inifile=FileLocate("WEHELP.INI")
  44.     filext = FileExtension(wGetFileName())
  45.     If filext == "" Then filext = "NONE"   ; section for files w/no extension
  46.     helpsec = IniReadPvt("EXTENSIONS", filext, "DEFAULT", inifile)
  47.     HFnum = 0
  48.  
  49.  
  50.  
  51.  
  52. ; Get the next help file from the list,
  53.  
  54. :KWHNEXTFILE
  55.     HFnum = HFnum + 1
  56.     wehinfo = StrUpper(IniReadPvt(helpsec, "HF%HFnum%", "NONE", inifile))
  57.     If wehinfo == "NONE" Then Message("%W9876A% Help Error - %helpword%", "No applicable help files found.")
  58.                          Then Goto KWHDONE
  59.     if wehinfo == "" then goto KWHNEXTFILE     ; Empty HFx setting, skip
  60.  
  61. ; Extract and build information from the HFx setting
  62.     ;debug(1)
  63.     HelpFileI=ItemExtract(1,wehinfo," ")
  64.     wehfile = StrCat(WEDir, "HELP\",FileRoot(HelpFileI), ".WEH")
  65.     if FileExist(wehfile)==@FALSE then wehfile=FileLocate(StrCat(FileRoot(HelpFileI),".WEH"))
  66.     wehtype=strtrim(strsub(wehinfo,strlen(HelpFileI)+2,strlen(wehinfo)-strlen(HelpFileI)-1))
  67.  
  68. ; Make sure we have a WEH file in the editor Help directory
  69.  
  70.     If !(FileExist(wehfile)) Then Message("WEHELP.INI Error", "%wehfile% not found")
  71.                              Then Goto KWHDONE
  72.  
  73. ; Read Keyword data from WEH file
  74.     wehdata=IniReadPvt("KEYWORDS",helpword,"",wehfile)
  75.     If wehdata == "" Then Goto KWHNEXTFILE    ; No keyword defined, try next file.
  76.     ;debug(0)
  77.  
  78. ; First of all, completely ignore path to help file specified and
  79. ; look in %W9876A% help directory FIRST!
  80.  
  81.         HelpFile=strcat(FileRoot(HelpFileI),'.',FileExtension(HelpFileI))
  82.         HelpFile2="%WEDir%HELP\%HelpFile%"         ;look in HELP dir first
  83.         if FileExist(HelpFile2) then goto KWHDOIT
  84.  
  85. ; Secondly, if that fails, try (suprise) actual INI file setting.
  86.  
  87.         HelpFile2=HelpFileI      ; then test actual ini setting
  88.         if FileExist(HelpFile2) then goto KWHDOIT
  89.  
  90. ; Remove directory, and let Windows search path
  91.         HelpFile2=HelpFile                         ; try local dir and path
  92.         if FileExist(HelpFile2) then goto KWHDOIT
  93.  
  94. ; See where !%$@# user installed editor and try there. (With \Help)
  95.         HelpFile2=IniReadPvt("WWWSetup","%W9876A%","","WWW-PROD.INI")
  96.         HelpFile2="%HelpFile2%\HELP\%HelpFile%"    ; check setup help dir
  97.         if FileExist(HelpFile2) then goto KWHDOIT
  98.  
  99. ; See where !%$@# user installed editor and try there. (WithOut \Help)
  100.         HelpFile2=IniReadPvt("WWWSetup","%W9876A%","","WWW-PROD.INI")
  101.         HelpFile2="%HelpFile2%\%HelpFile%"        ; check setup main dir
  102.         if FileExist(HelpFile2) then goto KWHDOIT
  103.  
  104. ; Check editor home dir just in case path search bypassed it
  105.         HelpFile2="%WEDir%%HelpFile%"            ; check editor dir
  106.         if FileExist(HelpFile2) then goto KWHDOIT
  107.  
  108. ; Give up and ask user....what a concept...
  109.  
  110.         :KWHHELPASK
  111.         HelpFile2=HelpFile                        ; ask user
  112.         CancelCmd="goto HELPCAN23"
  113.         HelpFile2=AskFileName("Please locate %HelpFile%","","Help Files (*.HLP)|*.HLP|",HelpFile2,1)
  114.         CancelCmd="exit"
  115.         goto HELPCAN24
  116.        ; HelpFile2=AskLine("Cannot locate %HelpFile2%","Please enter full path to %HelpFile% or empty line to ignore this file.",HelpFile2)
  117.  
  118. ; If cancelled, remove reference to help file from WEHELP.INI
  119. :HELPCAN23
  120.         a=AskYesNo(HelpFile2,"Do you wish to remove %HelpFile% from the help file search?")
  121.         if a==@YES  then IniWritePvt(helpsec,"HF%HFnum%","",inifile)
  122.                          then goto KWHNEXTFILE
  123.  
  124. :HELPCAN24
  125. ; Verify we can access help file user entered
  126.         if !FileExist(HelpFile2) then goto KWHHELPASK
  127.  
  128. ; Hey its there!.  Save info in WEHELP.INI file
  129.         IniWritePvt(helpsec,"HF%HFnum%",strcat(HelpFile2," ",wehtype),inifile)
  130.  
  131.         ; Look a case statement!!!
  132. :KWHDOIT
  133.         goto KWHTYPE%wehtype%
  134.  
  135.         :KWHTYPE1
  136.               wehdata=strreplace(wehdata,"~",strcat(num2char(13),num2char(10)))
  137.               Message(helpword,wehdata)
  138.               goto KWHDONE
  139.  
  140.         :KWHTYPE2
  141.               WinHelp(HelpFile2,"PARTIALKEY",helpword)
  142.               goto KWHDONE
  143.  
  144.         :KWHTYPE3
  145.  
  146.               ErrorMode(@OFF)
  147.               RunZoom(HelpFile2,helpword)
  148.               ErrorMode(@CANCEL)
  149.               if LastError()==1902 then Message("%W9876A% Help Error","Help for >%helpword%< not available.")
  150.               goto KWHDONE
  151.  
  152.         :KWHTYPE100
  153.            ; Put your HelpFileType 100 stuff here
  154.               Message("%W9876A% User Help - %HelpFile2%","Help for %helpword% goes here")
  155.               goto KWHDONE
  156.  
  157.  
  158.          
  159. :KWHDONE
  160. ; Drop variables to save memory space
  161.         Drop(HelpWord,WEDir,inifile,filext,helpsec,HFnum)
  162.         Drop(wehinfo,HelpFileI,wehfile,wehtype,wehdata,HelpFile,HelpFile2)
  163.  
  164.         Exit
  165. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  166. Exit      ; Put an exit here in case anyone ever drops through to cancel
  167.           ; Not that we would ever do anything like that ourselves...
  168. :CANCEL
  169.        %CancelCmd%
  170.